home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / WarpQuake / Src / r_shared.h < prev    next >
C/C++ Source or Header  |  2000-05-22  |  5KB  |  158 lines

  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3.  
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License
  6. as published by the Free Software Foundation; either version 2
  7. of the License, or (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  12.  
  13. See the GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. */
  20. #ifndef GLQUAKE
  21. // r_shared.h: general refresh-related stuff shared between the refresh and the
  22. // driver
  23.  
  24. // FIXME: clean up and move into d_iface.h
  25.  
  26. #ifndef _R_SHARED_H_
  27. #define _R_SHARED_H_
  28.  
  29. #define    MAXVERTS    16                    // max points in a surface polygon
  30. #define MAXWORKINGVERTS    (MAXVERTS+4)    // max points in an intermediate
  31.                                         //  polygon (while processing)
  32. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  33. #define    MAXHEIGHT        1024
  34. #define    MAXWIDTH        1280
  35. #define MAXDIMENSION    ((MAXHEIGHT > MAXWIDTH) ? MAXHEIGHT : MAXWIDTH)
  36.  
  37. #define SIN_BUFFER_SIZE    (MAXDIMENSION+CYCLE)
  38.  
  39. #define INFINITE_DISTANCE    0x10000        // distance that's always guaranteed to
  40.                                         //  be farther away than anything in
  41.                                         //  the scene
  42.  
  43. //===================================================================
  44.  
  45. extern void    R_DrawLine (polyvert_t *polyvert0, polyvert_t *polyvert1);
  46.  
  47. extern int        cachewidth;
  48. extern pixel_t    *cacheblock;
  49. extern int        screenwidth;
  50.  
  51. extern    float    pixelAspect;
  52.  
  53. extern int        r_drawnpolycount;
  54.  
  55. extern cvar_t    r_clearcolor;
  56.  
  57. extern int    sintable[SIN_BUFFER_SIZE];
  58. extern int    intsintable[SIN_BUFFER_SIZE];
  59.  
  60. extern    vec3_t    vup, base_vup;
  61. extern    vec3_t    vpn, base_vpn;
  62. extern    vec3_t    vright, base_vright;
  63. extern    entity_t        *currententity;
  64.  
  65. #define NUMSTACKEDGES        2400
  66. #define    MINEDGES            NUMSTACKEDGES
  67. #define NUMSTACKSURFACES    800
  68. #define MINSURFACES            NUMSTACKSURFACES
  69. #define    MAXSPANS            3000
  70.  
  71. // !!! if this is changed, it must be changed in asm_draw.h too !!!
  72. typedef struct espan_s
  73. {
  74.     int                u, v, count;
  75.     struct espan_s    *pnext;
  76. } espan_t;
  77.  
  78. // FIXME: compress, make a union if that will help
  79. // insubmodel is only 1, flags is fewer than 32, spanstate could be a byte
  80. typedef struct surf_s
  81. {
  82.     struct surf_s    *next;            // active surface stack in r_edge.c
  83.     struct surf_s    *prev;            // used in r_edge.c for active surf stack
  84.     struct espan_s    *spans;            // pointer to linked list of spans to draw
  85.     int            key;                // sorting key (BSP order)
  86.     int            last_u;                // set during tracing
  87.     int            spanstate;            // 0 = not in span
  88.                                     // 1 = in span
  89.                                     // -1 = in inverted span (end before
  90.                                     //  start)
  91.     int            flags;                // currentface flags
  92.     void        *data;                // associated data like msurface_t
  93.     entity_t    *entity;
  94.     float        nearzi;                // nearest 1/z on surface, for mipmapping
  95.     qboolean    insubmodel;
  96.     float        d_ziorigin, d_zistepu, d_zistepv;
  97.  
  98.     int            pad[2];                // to 64 bytes
  99. } surf_t;
  100.  
  101. extern    surf_t    *surfaces, *surface_p, *surf_max;
  102.  
  103. // surfaces are generated in back to front order by the bsp, so if a surf
  104. // pointer is greater than another one, it should be drawn in front
  105. // surfaces[1] is the background, and is used as the active surface stack.
  106. // surfaces[0] is a dummy, because index 0 is used to indicate no surface
  107. //  attached to an edge_t
  108.  
  109. //===================================================================
  110.  
  111. extern vec3_t    sxformaxis[4];    // s axis transformed into viewspace
  112. extern vec3_t    txformaxis[4];    // t axis transformed into viewspac
  113.  
  114. extern vec3_t    modelorg, base_modelorg;
  115.  
  116. extern    float    xcenter, ycenter;
  117. extern    float    xscale, yscale;
  118. extern    float    xscaleinv, yscaleinv;
  119. extern    float    xscaleshrink, yscaleshrink;
  120.  
  121. extern    int d_lightstylevalue[256]; // 8.8 frac of base light value
  122.  
  123. extern void TransformVector (vec3_t in, vec3_t out);
  124. extern void SetUpForLineScan(fixed8_t startvertu, fixed8_t startvertv,
  125.     fixed8_t endvertu, fixed8_t endvertv);
  126.  
  127. extern int    r_skymade;
  128. extern void R_MakeSky (void);
  129.  
  130. extern int    ubasestep, errorterm, erroradjustup, erroradjustdown;
  131.  
  132. // flags in finalvert_t.flags
  133. #define ALIAS_LEFT_CLIP                0x0001
  134. #define ALIAS_TOP_CLIP                0x0002
  135. #define ALIAS_RIGHT_CLIP            0x0004
  136. #define ALIAS_BOTTOM_CLIP            0x0008
  137. #define ALIAS_Z_CLIP                0x0010
  138. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  139. #define ALIAS_ONSEAM                0x0020    // also defined in modelgen.h;
  140.                                             //  must be kept in sync
  141. #define ALIAS_XY_CLIP_MASK            0x000F
  142.  
  143. // !!! if this is changed, it must be changed in asm_draw.h too !!!
  144. typedef struct edge_s
  145. {
  146.     fixed16_t        u;
  147.     fixed16_t        u_step;
  148.     struct edge_s    *prev, *next;
  149.     unsigned short    surfs[2];
  150.     struct edge_s    *nextremove;
  151.     float            nearzi;
  152.     medge_t            *owner;
  153. } edge_t;
  154.  
  155. #endif    // _R_SHARED_H_
  156.  
  157. #endif    // GLQUAKE
  158.